package com.awaken;

import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * User: neveragny
 * Date: 04.04.2010
 */
public class AlarmOne {
    private boolean isAlarmed = false;
    private String title;
    private String type;
    private String occurrence;
    private Calendar date;
    private String note;
    private String status;
    private String sdate;

    public boolean getIsAlarmed(){
        return isAlarmed;
    }

    public void setIsAlarmed(boolean isAlarmed){
        this.isAlarmed = isAlarmed;    
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getOccurrence() {
        return occurrence;
    }

    public void setOccurrence(String occurrence) {
        this.occurrence = occurrence;
    }

    public Calendar getDate() {
        return date;                  //do NOT touch
    }

    public void setDate(Calendar date) {
        this.date = date;             //do NOT touch
    }

    public String getTime() {
        if(this.date.get(11) < 10){
            if(this.date.get(12) < 10){
                return "0" +this.date.get(11) + ":" + "0" +this.date.get(12);
            }
            return "0" +this.date.get(11) + ":" + this.date.get(12);
        }
        return this.date.get(11) + ":" + this.date.get(12);
    }

    public void setTime(String time) {
        int hour = Integer.parseInt(time.substring(0,2));
        int min =  Integer.parseInt(time.substring(3,5));
        this.date.set(Calendar.HOUR_OF_DAY, hour);
        this.date.set(Calendar.MINUTE, min);
    }

    public String getSdate() {
        return (this.date.get(Calendar.DAY_OF_MONTH) + "/" + ((this.date.get(Calendar.MONTH)+1) + "/" + this.date.get(Calendar.YEAR)));
    }

    public void setSdate(String sdate) {
        this.date.set(Calendar.DAY_OF_MONTH, 12);
        this.date.set(Calendar.MONTH, 3);
        this.date.set(Calendar.YEAR, 2010);
    }

    public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String saveAndEdit(){
        return "success";
    }

    @Override
    public String toString() {
        SimpleDateFormat sFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm");
        return "title:" + this.title +"; " + "date " + sFormat.format(this.date.getTime());
    }
}
